{{- /* remove whitespaces */ -}}
<pre class="mermaid{{ with .Get "class" }} {{ . }}{{ end }}">
  {{- .Inner | htmlEscape | safeHTML -}}
</pre>
{{- if not (.Page.Store.Get "mermaid") -}}
  {{- /* Include mermaid only first time */ -}}
  {{- with resources.Get "mermaid.json" | minify -}}
  <script src="{{ "mermaid.min.js" | relURL }}" onload="mermaid.initialize({{ .Content | safeJS }})"></script>
  {{- end -}}
  {{- .Page.Store.Set "mermaid" true -}}
{{- end -}}